<template>
    <transition name="slide-up">
        <div v-show="visible" class="fixed-action-bar">
            <!-- 左侧插槽 -->
            <div class="left-actions" v-if="$slots.left">
                <slot name="left"></slot>
            </div>

            <!-- 默认插槽（主内容区） -->
            <div class="main-actions">
                <slot></slot>
            </div>

            <!-- 右侧插槽 -->
            <div class="right-actions" v-if="$slots.right">
                <slot name="right"></slot>
            </div>
        </div>
    </transition>
</template>

<script setup>
import { defineProps } from 'vue'

defineProps({
    visible: {
        type: Boolean,
        default: false
    }
})
</script>

<style scoped>
.fixed-action-bar {
    position: fixed;
    bottom: 0;
    left: 18%;
    /* 匹配左侧菜单宽度 */
    right: 0;
    padding: 16px;
    background: white;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.left-actions,
.right-actions {
    flex: 0 0 auto;
}

.main-actions {
    flex: 1;
    display: flex;
    justify-content: center;
    gap: 12px;
}

.slide-up-enter-active,
.slide-up-leave-active {
    transition: all 0.3s ease;
}

.slide-up-enter-from,
.slide-up-leave-to {
    transform: translateY(100%);
}
</style>
